import { _decorator, Component, Button } from 'cc';
import { GameManager } from './GameManager';
const { ccclass, property } = _decorator;

@ccclass('RotateButton')
export class RotateButton extends Component {
    onLoad() {
        // 获取按钮组件并添加点击事件
        const button = this.getComponent(Button);
        button.node.on(Button.EventType.CLICK, this.onRotateClick, this);
    }

    private onRotateClick() {
        // 调用 GameManager 的旋转方法
        GameManager.instance.rotatePickedCellGroup();
    }

    onDestroy() {
        const button = this.getComponent(Button);
        button.node.off(Button.EventType.CLICK, this.onRotateClick, this);
    }
} 